<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib  uri="http://java.sun.com/jsp/jstl/core"  prefix="c" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<script type="text/javascript" src="${ctx}/js/backend/backend.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery-1.11.1.min_044d0927.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery.bxslider_e88acd1b.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="${ctx}/js/shade.js"></script>
  <%@ include file="/header.jsp" %>
</head>
<body>
<%@ include file="/searchBar.jsp" %>
<!--End Header End-->
 
<div class="i_bg bg_color">
  <!--Begin 用户中心 Begin -->
  <div class="m_content">
    <%@ include file="/LeftBar.jsp"%>
    <div class="m_right" id="content">
      <div class="mem_tit">商品列表</div>
      <br>
      <table border="0" class="order_tab" style="width:930px; text-align:center; margin-bottom:30px;" cellspacing="0" cellpadding="0">
        <tbody>
        <tr>
          <td width="10%">商品名称</td>
          <td width="10%">商品图片</td>
          <td width="5%">库存</td>
          <td width="10%">价格</td>
          <td width="10%" colspan="2">操作</td>
        </tr>
        <c:forEach items="${utils.list}" var="temp">
          <tr>
            <td>${temp.name}</td>
            <td>
              <a href="AdminProductServlet?action=queryProductDeatil&id=${temp.id}" target="_blank">
                  <img src="${ctx}/images/files/${temp.fileName}" width="50" height="50"/>
              </a>
            </td>
            <td>${temp.stock}</td>
            <td>${temp.price}</td>
            <td><a href="AdminProductServlet?action=toUpdateProduct&id=${temp.id}">修改</a></td>
            <td><a href="javascript:void(0);" onclick="deleteById('${temp.id}');">删除</a></td>
          </tr>
        </c:forEach>
        </tbody>
      </table>
      <div class="pages">
                <c:set var="url" value="${ctx}/AdminProductServlet?action=index"></c:set>
                	<a href="${url}&currpage=1" class="p_pre">首页</a>
                <c:if test="${utils.pageindex > 1}">
                	<a href="${url}&currpage=${utils.pageindex-1}" class="p_pre">上一页</a>
				</c:if>
                	
                <c:forEach  var="temp" begin="1" end="${utils.pagecount-utils.pageindex>3?utils.pageindex+3:utils.pagecount}"   >
               		
		            <c:if test="${utils.pageindex==temp }">
		                <a href="${url}&currpage=${temp}" class="cur">${temp}</a>
		            </c:if>
		            <c:if test="${utils.pageindex!=temp }">
		                <a href="${url}&currpage=${temp}">${temp}</a>
		            </c:if>
		       </c:forEach>
                	
                	
                <c:if test="${utils.pageindex < utils.pagecount}">
                	<a href="${url}&currpage=${utils.pageindex+1}" class="p_pre">下一页</a>
				</c:if>
				
				
                	<a href="${url}&currpage=${utils.pagecount}" class="p_pre">尾页</a>
                	
				 <c:if test="${utils.pagecount==0}">
				        暂无记录
				    </c:if>
                </div>
    </div>
  </div>
  <%@ include file="/footer.jsp" %>
</div>
</body>
</html>
